<?php
/*用户资料*/
namespace Admin\Controller;
use Think\Page;//分页类

class AdmininfoController extends BaseController {

    public function list_(){

        #+----------------------------------
        # * 查询
        #+----------------------------------
        $uid = $_COOKIE['wen_admin_userid'];

        $info = M()->query("SELECT *,a.des as a_des FROM  adminuser AS a LEFT JOIN admingroup AS b on a.group_id = b.id WHERE a.id =  $uid");
        
  
        $this -> assign( "info", $info[0]); 
     

        #+----------------------------------
        # * 显示页面
        #+----------------------------------
    	$this->display();
    }
    public function edit(){
        $id = $_COOKIE['wen_admin_userid'];
        //处理img地址
        $arr = $_GET;
        $search = array(__ROOT__,'/public/images/');
        $arr['avater'] = str_replace($search,'',$_GET['avater']);
        $re = M('adminuser')->where("id=$id")->save($arr);
         // echo M()->getLastSql();exit;
        if($re){
            echojson('修改成功',1);
        }else{
            echojson('修改失败',0);
        }
       

        
        
    }
}